﻿package lobby
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import lobby.events.LobbyEvent;
	import lobby.exchangeddata.HashTable;
	import lobby.interfaces.ILanguage;
	
	/**
	 * ...
	 * @author Tom
	 */
	public class FormLogin extends MovieClip implements ILanguage
	{
		public var loadLogo_mc:LoadMc;
		public var bigLogo:MovieClip;
		public var loginPanel:LoginPanel;
		private var mc:MovieClip;
		
		public function FormLogin()
		{
			this.visible = false;
			
			mc = new MovieClip();
			loadLogo_mc = new LoadMc();
			loadLogo_mc.addEventListener(LobbyEvent.MOVIE_LOADED, setLocation);
		}
		
		private function setLocation(e:LobbyEvent):void
		{
			var ratio = Math.min(bigLogo.width / mc.width, bigLogo.height / mc.height);
			mc.scaleX = mc.scaleY = ratio;
			bigLogo.addChild(mc);
			mc.x = (bigLogo.width - mc.width) / 2;
			mc.y = (bigLogo.height - mc.height) / 2;
		}
		
		public function loadLogo():void
		{
			var logo_linked:String = GlobalVariables.subDomain;
			if (logo_linked == "localhost")
				logo_linked = "all";
			var swfName:String = "logo/" + logo_linked + "/logo_b.swf";
			loadLogo_mc.loadSwf(swfName, mc);
		}
		
		public function changeTextLang(info:HashTable):void
		{
			loginPanel.changeTextLang(info);
		}
		
		public function resetText():void
		{
			loginPanel.resetText();
		}
		
		public function updateComboBox():void
		{
			loginPanel.updateComboBox();
		}
	}

}